/**
 * 
 */
package sk.lukaskrupa.guess.the.color.core;

import sk.lukaskrupa.guess.the.color.ui.R;

/**
 * Enumeration of all possible colors.
 * 
 * @author Lukas Krupa (lukas0krupa@gmail.com)
 * 
 */
public enum ColorEnum {

	BLACK(R.drawable.black), BLUE(R.drawable.blue), GREEN(R.drawable.green), RED(R.drawable.red), WHITE(R.drawable.white), YELLOW(
			R.drawable.yellow), BROWN(R.drawable.brown), PURPLE(R.drawable.purple),
	/*
	 * PINK ( R . drawable . ping )
	 */
	HIDDEN(R.drawable.hidden_color), NONE(R.drawable.none);

	private int drawableId;

	/**
	 * Initialization of all enums.
	 * 
	 * @param drawableId
	 *            to be used (original ID)
	 */
	private ColorEnum(int drawableId) {
		this.drawableId = drawableId;
	}

	/**
	 * Return ColorEnum according to Drawable ID.
	 * 
	 * @param id
	 *            used in context
	 * @return ColorEnum enum
	 */
	public static ColorEnum getColorById(int id) {

		for (ColorEnum singleEnum : values()) {
			if (singleEnum.getDrawableId() == id) {
				return singleEnum;
			}
		}

		throw new IllegalArgumentException("Invalid drawable ID to compare with. (Our of posible values)");
	}

	/**
	 * Gets value drawableId.
	 * 
	 * @return the drawableId
	 */
	public int getDrawableId() {
		return this.drawableId;
	}

}
